<#assign className = table.className>   
<#assign classNameLower = className?uncap_first> 
package ${basepackage}.${subpackage}.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import com.yidian.ep.model.PageList;
import com.yidian.ep.model.${className};
import com.yidian.ep.service.${className}Service;
import com.yidian.ep.service.impl.PublicServiceImpl;
import com.yidian.ep.util.DateUtils;

@Service
public class ${className}ServiceImpl extends PublicServiceImpl implements ${className}Service{

	@Override
	public PageList get${className}List(${className} ${classNameLower}, String keyword, PageList pageList) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("keyword", keyword);
		map.put("start", pageList.getFirstResult());
		map.put("size", pageList.getPageSize());
		map.put("status", 1);
		return findPublicPageInfor("get${className}ListForPageCount", "get${className}ListForPage", pageList, map);
	}
	
	@Override
	public List<${className}> get${className}s(${className} ${classNameLower}, String keyword, int currPage, int pageSize) {
		Map<String, Object> map = new HashMap<String, Object>();
		currPage = currPage > 0 ? currPage : 1;
		map.put("keyword", keyword);
		map.put("start", (currPage -1) * pageSize);
		map.put("size", pageSize);
		map.put("status", 1);
		List<${className}> list = publicDao.selectPublicAllBeanList("get${className}s", map);
		return list;
	}

	@Override
	public ${className} get${className}ById(int id) {
		if (id > 0) {
			return publicDao.findPublicBeanById("get${className}ByID", id);
		}
		return null;
	}

	@Override
	public void add${className}(${className} ${classNameLower}) {
		if (${classNameLower} != null) {
			${classNameLower}.setStatus(1);
			${classNameLower}.setCreateTime(DateUtils.getDate2LStr(DateUtils.getCurrentDate()));
			publicDao.addPublicBeanInfor("add${className}", ${classNameLower});
		}
	}

	@Override
	public void update${className}(${className} ${classNameLower}) {
		if (${classNameLower} != null) {
			publicDao.updatePublicBeanInfor("update${className}", ${classNameLower});
		}
	}

	@Override
	public void delete${className}(String[] ids,String userId) {
		if (ids != null && ids.length > 0) {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("status", 2);
			map.put("userId", userId);
			for (String id : ids) {
				map.put("id", id);
				publicDao.deletePublicBeanById("delete${className}", map);
			}
		}
	}

}
